<?php

class Obj_DBTable_ObjectType extends Zend_Db_Table_Abstract
{
    protected $_name = 'object_types';
    protected $_primary = 'ID';
    
    
    public function getObjectTypes($activeOnly = false) {
    	$select = $this->select()->from($this)->order('Name');
    	if ($activeOnly === true) $select->where('Active = 1');
    	return $this->fetchAll($select)->toArray();
    }
     
    public function getObjectType($id) {
    	$select = $this->select()->from($this)->where('ID = ?', (int) $id);
    	$res = $this->fetchRow($select);
    	if ($res) {
    		return $res->toArray();
    	}
    	return false;
    } 
    
    public function delete($where)
    {
        return $this->_db->delete($this->_name, $where);
    }    
}